﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DBModel;

namespace CV_Projekt
{
    public partial class FormWorkSearch : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void ListView_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            var item = e.Item as ListViewDataItem;
         
            if (item != null)
            {
                var dataKey = ListView.DataKeys[item.DisplayIndex];              
                if (dataKey != null)
                {
                    var workId = (int) dataKey.Value;
                    Session["Work"] = WorkAdvertisementDB.GetWorkAdvertisementById(workId);
                }        
            }
            Response.Redirect("WorkDescription.aspx");
        }

    }
}